package com.zbkj.crmeb.enums.logistics;

import com.baomidou.mybatisplus.core.enums.IEnum;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;

/**
 * 物流操作平台
 *
 * @author lvmd
 * @date 2021-01-06
 */
public enum DeliveryChannelEnum implements IEnum<Integer> {
    /**
     * 平台
     */
    PLATFORM(0, "平台"),

    /**
     * 商家后台
     */
    MERCHANT(1, "商家后台"),

    /**
     * 物流部门
     */
    DELIVERY(2, "物流部门"),
    /**
     * 供应商
     */
    SUPPLIER(3, "供应商"),

    ;

    private final Integer code;
    private final String msg;

    DeliveryChannelEnum(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public Integer getCode() {
        return code;
    }

    public String getMsg() {
        return msg;
    }

    @JsonCreator
    public static DeliveryChannelEnum valueOf(Integer code) {
        for (DeliveryChannelEnum value : values()) {
            if (code.equals(value.getCode())) {
                return value;
            }
        }
        return DeliveryChannelEnum.PLATFORM;
    }

    @Override
    @JsonValue
    public Integer getValue() {
        return code;
    }

}

